package com.example.badminton.controller;

import com.example.badminton.common.AnonymousAccess;
import com.example.badminton.common.Result;
import com.example.badminton.entity.Venue;
import com.example.badminton.service.VenueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/venue")
@CrossOrigin
public class VenueController {
    
    @Autowired
    private VenueService venueService;
    
    /**
     * 获取场馆信息
     */
    @AnonymousAccess
    @GetMapping("/info")
    public Result<?> getVenueInfo() {
        try {
            Venue venue = venueService.getVenueInfo();
            if (venue == null) {
                return Result.error("场馆信息不存在");
            }
            return Result.success(venue);
        } catch (Exception e) {
            return Result.error("获取场馆信息失败: " + e.getMessage());
        }
    }
} 